<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link href="../css/docs.css" type="text/css" rel="stylesheet" />
<link href="../css/prettify.css" type="text/css" rel="stylesheet" />
<script src="../js/prettify.js" type="text/javascript"></script>
</head>
<body onLoad="prettyPrint()">
<div class="g-unit" id="doc-content">
<div id="api-info-block">
    <div class="api-level">H3C CAS云管理平台</div>
  </div>
  <div id="jd-header">
    <h1>虚拟机部署</h1>
  </div>
</div>
<div id="jd-content">
<div class="jd-descr">
<p>部署虚拟机</p>
<h2><a name="uri"></a>接口 URI</h2>
<p>/cas/casrs/vm/deploy</p>
<h2><a name="access"></a>访问方法</h2>
<dl>
  <dt><b>HTTP 方法</b></dt>
  <dd>POST</dd>
  <dt><b>消息体</b></dt>
  <div class="source">
    <pre class="prettyprint lang-xml">
demo 1：	
&lt;domainConfig&gt;<br>    &lt;id&gt;69&lt;/id&gt;<br>    &lt;domainName&gt;ccc&lt;/domainName&gt;<br>    &lt;title&gt;ccc&lt;/title&gt;<br>    &lt;targetHostId&gt;1&lt;/targetHostId&gt;<br>    &lt;deployMode&gt;1&lt;/deployMode&gt;<br>    &lt;protectMode&gt;0&lt;/protectMode&gt;<br>    &lt;userData&gt;mkdir vmFile&lt;/userData&gt;<br>   &lt;storage&gt;<br>        &lt;src&gt;mini_for_v_cvkzyb_test4&lt;/src&gt;<br>        &lt;dest&gt;ccc&lt;/dest&gt;<br>        &lt;pool&gt;serverpool&lt;/pool&gt;<br>    &lt;/storage&gt;<br>    &lt;network&gt;<br>        &lt;mac&gt;0c:da:41:1d:cc:7b&lt;/mac&gt;<br>        &lt;vSwitchName&gt;vswitch0&lt;/vSwitchName&gt;<br>        &lt;profileName&gt;Default&lt;/profileName&gt;<br>        &lt;sysIpType&gt;2&lt;/sysIpType&gt;<br>        &lt;ip&gt;192.168.20.20&lt;/ip&gt;<br>        &lt;sysMask&gt;255.255.0.0&lt;/sysMask&gt;<br>        &lt;sysGateway&gt;192.168.20.1&lt;/sysGateway&gt;<br>        &lt;sysDns&gt;8.8.8.8&lt;/sysDns&gt;<br>        &lt;secondaryDns&gt;8.8.8.7&lt;/secondaryDns&gt;<br>        &lt;isBindIp&gt;false&lt;/isBindIp&gt;<br>    &lt;/network&gt;
&lt;/domainConfig&gt;

demo 2：
&lt;domainConfig&gt;<br>    &lt;id&gt;69&lt;/id&gt;<br>    &lt;domainName&gt;ccc&lt;/domainName&gt;<br>    &lt;title&gt;ccc&lt;/title&gt;<br>    &lt;targetHostId&gt;1&lt;/targetHostId&gt;<br>    &lt;deployMode&gt;1&lt;/deployMode&gt;<br>    &lt;protectMode&gt;0&lt;/protectMode&gt;<br>    &lt;userData&gt;mkdir vmFile&lt;/userData&gt;<br>   &lt;storage&gt;<br>        &lt;src&gt;mini_for_v_cvkzyb_test4&lt;/src&gt;<br>        &lt;dest&gt;ccc&lt;/dest&gt;<br>        &lt;pool&gt;serverpool&lt;/pool&gt;<br>    &lt;/storage&gt;<br>    &lt;network&gt;<br>        &lt;mac&gt;0c:da:41:1d:cc:7b&lt;/mac&gt;<br>        &lt;vSwitchName&gt;vswitch0&lt;/vSwitchName&gt;<br>        &lt;profileName&gt;Default&lt;/profileName&gt;<br>    &lt;/network&gt;
    &lt;osInfo&gt;
        &lt;initType&gt;0&lt;/initType&gt;
        &lt;sysName&gt;hostName&lt;/sysName&gt;
        &lt;regOrGroupType&gt;2&lt;/regOrGroupType&gt;
        &lt;regOrGroup&gt;workgroup&lt;/regOrGroup&gt;
        &lt;loginAccount&gt;Administrator&lt;/loginAccount&gt;
        &lt;loginPassword&gt;qwe@123&lt;/loginPassword&gt;
        &lt;localgroup&gt;Administrators&lt;/localgroup&gt;
        &lt;sysIp&gt;192.168.12.15&lt;/sysIp&gt;
        &lt;sysMask&gt;255.255.255.0&lt;/sysMask&gt;
        &lt;sysGateway&gt;192.168.12.1&lt;/sysGateway&gt;
        &lt;sysdns&gt;12.26.15.24&lt;/sysdns&gt;
        &lt;secondaryDns&gt;12.26.15.25&lt;/secondaryDns&gt;
        &lt;isBindIp&gt;true&lt;/isBindIp&gt;
    &lt;/osInfo&gt;
&lt;/domainConfig&gt;</pre>
  </div>
</dl>

<dt><a name="detail"></a><b>元素含义</b></dt>
  <table id="pubmethods" class="jd-sumtable">
    <tbody>
      <tr>
        <th colspan="2"><span class="prettyprint lang-xml">domainConfig</span>各子元素</th>
      </tr>
      <tr>
        <td class="jd-typecol"><div align="right"><span class="prettyprint lang-xml">id</span></div></td>
        <td width="100%" class="jd-linkcol"><span class="sympad"></span>模板ID
            <div class="jd-descrdiv">长整数（long）类型。</div></td>
      </tr>
      <tr class="alt-color">
        <td class="jd-typecol"><div align="right"><span class="prettyprint lang-xml">domainName</span></div></td>
        <td class="jd-linkcol">部署虚拟机名字。
          <div class="jd-descrdiv">字符串（String）类型。</div></td>
      </tr>
      
      <tr class="jd-typecol">
        <td class="jd-typecol"><div align="right"><span class="prettyprint lang-xml">title</span></div></td>
        <td class="jd-linkcol">部署虚拟机显示名字。
          <div class="jd-descrdiv">字符串（String）类型。</div></td>
      </tr>
      
      <tr class="alt-color">
        <td class="alt-color"><div align="right"><span class="prettyprint lang-xml">desc</span></div></td>
        <td class="jd-linkcol"><span class="sympad">虚拟机描述信息</span>
          <div class="jd-descrdiv">字符串（String）类型。</div></td>
      </tr>
    <tr class="jd-typecol">
        <td class="jd-typecol"><div align="right"><span class="prettyprint lang-xml">targetHostId</span></div></td>
        <td class="jd-linkcol"><span class="sympad">目标主机ID</span>
          <div class="jd-descrdiv">长整型（long）类型。</div></td>
      </tr>
    <tr class="alt-color">
        <td class="alt-color"><div align="right"><span class="prettyprint lang-xml">deployModel</span></div></td>
        <td class="jd-linkcol"><span class="sympad">部署虚拟机方式（0表述正常部署，1表示快速部署）。</span>
          <div class="jd-descrdiv">整数（int）类型。</div></td>
    </tr>
	<tr class="jd-typecol">
        <td class="alt-color"><div align="right"><span class="prettyprint lang-xml">protectMode</span></div></td>
        <td class="jd-linkcol"><span class="sympad">保护模式（0表示非保护模式，1表示保护模式），可选。</span>
          <div class="jd-descrdiv">整数（int）类型。</div></td>
    </tr>
	<tr class="jd-typecol">
        <td class="alt-color"><div align="right"><span class="prettyprint lang-xml">userData</span></div></td>
        <td class="jd-linkcol"><span class="sympad">部署保护模式虚拟机时，用户定制命令。可选。</span>
          <div class="jd-descrdiv">字符串（String）类型。</div></td>
    </tr>
    <tr class="alt-color">
        <td class="jd-typecol"><div align="right"><span class="prettyprint lang-xml">storage</span></div></td>
        <td class="jd-linkcol">虚拟机存储列表。
          <div class="jd-descrdiv">
            <DIV>集合（List）类型。</DIV>
          </div></td></tr>
    <tr class="jd-typecol">
        <td class="jd-typecol"><div align="right"><span class="prettyprint lang-xml">network</span></div></td>
        <td class="jd-linkcol">虚拟机网卡信息列表。
          <div class="jd-descrdiv">
            <DIV>集合（List）类型。</DIV>
          </div></td></tr>
  </table>
  <table id="pubmethods" class="jd-sumtable">
    <tbody>
      <tr>
        <th colspan="2"><span class="prettyprint lang-xml">storage</span>各子元素</th>
      </tr>
      <tr>
        <td class="jd-typecol"><div align="right"><span class="prettyprint lang-xml">src</span></div></td>
        <td width="100%" class="jd-linkcol"><span class="sympad">原存储镜像文件名。</span>
          <div class="jd-descrdiv">字符串（String）类型。</div></td>
      </tr>
      <tr class="alt-color">
        <td class="jd-typecol"><div align="right"><span class="prettyprint lang-xml">dest</span></div></td>
        <td class="jd-linkcol"><span class="sympad">目的存储镜像文件名。</span>
          <div class="jd-descrdiv">字符串（String）类型。</div></td>
      </tr>
      <tr>
        <td class="jd-typecol"><div align="right"><span class="prettyprint lang-xml">pool</span></div></td>
        <td class="jd-linkcol"><span class="sympad">目的存储池。</span>
          <div class="jd-descrdiv">字符串（String）类型。</div></td>
      </tr>   
  </table>
  <table id="pubmethods" class="jd-sumtable">
    <tbody>
      <tr>
        <th colspan="2"><span class="prettyprint lang-xml">network</span>各子元素</th>
      </tr>
      <tr>
        <td class="jd-typecol"><div align="right"><span class="prettyprint lang-xml">mac</span></div></td>
        <td width="100%" class="jd-linkcol"><span class="sympad">虚拟机模板的网卡MAC地址。</span>
          <div class="jd-descrdiv">字符串（String）类型。</div></td>
      </tr>
	  <tr class="alt-color">
        <td class="jd-typecol"><div align="right"><span class="prettyprint lang-xml">vSwitchName</span></div></td>
        <td class="jd-linkcol"><span class="sympad">网络交换机名称。</span>
          <div class="jd-descrdiv">字符串（String）类型。</div></td>
      </tr>
	  <tr>
        <td class="jd-typecol"><div align="right"><span class="prettyprint lang-xml">profileName</span></div></td>
        <td class="jd-linkcol"><span class="sympad">网络策略模板名称。</span>
          <div class="jd-descrdiv">字符串（String）类型。</div></td>
      </tr>
      <tr class="alt-color">
        <td class="jd-typecol"><div align="right">sysIpType</div></td>
        <td class="jd-linkcol"><span class="sympad">网络设置模式（1表示DHCP，2表示手工指定IP等信息）。</span>
          <div class="jd-descrdiv">整数（int）类型。</div></td>
      </tr>
	  <tr>
        <td class="jd-typecol"><div align="right">ip</div></td>
        <td class="jd-linkcol"><span class="sympad">网卡分配的IP地址。</span>
          <div class="jd-descrdiv">字符串（String）类型。</div></td>
      </tr>
	  <tr class="alt-color">
        <td class="jd-typecol"><div align="right"><span class="prettyprint lang-xml">sysMask</span></div></td>
        <td class="jd-linkcol"><span class="sympad">子网掩码。</span>
          <div class="jd-descrdiv">字符串（String）类型。</div></td>
      </tr>
	  <tr>
        <td class="jd-typecol"><div align="right">sysGateway</div></td>
        <td class="jd-linkcol"><span class="sympad">网关地址。</span>
          <div class="jd-descrdiv">字符串（String）类型。</div></td>
      </tr>
	  <tr class="alt-color">
        <td class="jd-typecol"><div align="right"><span class="prettyprint lang-xml">sysDns</span></div></td>
        <td class="jd-linkcol"><span class="sympad">首选DNS服务器地址。</span>
          <div class="jd-descrdiv">字符串（String）类型。</div></td>
      </tr>
	  <tr>
        <td class="jd-typecol"><div align="right">secondaryDns</div></td>
        <td class="jd-linkcol"><span class="sympad">备用DNS服务器地址。</span>
          <div class="jd-descrdiv">字符串（String）类型。</div></td>
      </tr>
	  <tr class="alt-color">
        <td class="jd-typecol"><div align="right"><span class="prettyprint lang-xml">isBindIp</span></div></td>
        <td class="jd-linkcol"><span class="sympad">是否绑定网卡IP地址。</span>
          <div class="jd-descrdiv">枚举值：true 或 false（字母需全部小写）。</div></td>
      </tr>
  </table>
  
  <table id="pubmethods" class="jd-sumtable">
    <tbody>
      <tr>
        <th colspan="2"><span class="prettyprint lang-xml">osInfo</span>各子元素（可选）</th>
      </tr>
      <tr>
        <td class="jd-typecol"><div align="right"><span class="prettyprint lang-xml">initType</span></div></td>
        <td width="100%" class="jd-linkcol"><span class="sympad">设置系统参数方式（0：快速初始化，1：完全初始化。）。</span>
          <div class="jd-descrdiv">整数（Integer）类型。</div></td>
      </tr>
      <tr class="alt-color">
        <td class="jd-typecol"><div align="right"><span class="prettyprint lang-xml">sysName</span></div></td>
        <td class="jd-linkcol"><span class="sympad">设置主机名。</span>
          <div class="jd-descrdiv">字符串（String）类型。</div></td>
      </tr>
      <tr>
        <td class="jd-typecol"><div align="right"><span class="prettyprint lang-xml">regOrGroupType</span></div></td>
        <td class="jd-linkcol"><span class="sympad">隶属于域或者工作组（1：域，2：工作组。）。</span>
          <div class="jd-descrdiv">字符串（String）类型。</div></td>
      </tr>  
	  <tr class="alt-color">
        <td class="jd-typecol"><div align="right"><span class="prettyprint lang-xml">regOrGroup</span></div></td>
        <td class="jd-linkcol"><span class="sympad">域或者工作组值。</span>
          <div class="jd-descrdiv">字符串（String）类型。</div></td>
      </tr>
      <tr>
        <td class="jd-typecol"><div align="right"><span class="prettyprint lang-xml">loginAccount</span></div></td>
        <td class="jd-linkcol"><span class="sympad">登录帐号。</span>
          <div class="jd-descrdiv">字符串（String）类型。</div></td>
      </tr>
	  <tr class="alt-color">
        <td class="jd-typecol"><div align="right"><span class="prettyprint lang-xml">loginPassword</span></div></td>
        <td class="jd-linkcol"><span class="sympad">登录密码。</span>
          <div class="jd-descrdiv">字符串（String）类型。</div></td>
      </tr>
      <tr>
        <td class="jd-typecol"><div align="right"><span class="prettyprint lang-xml">localgroup</span></div></td>
        <td class="jd-linkcol"><span class="sympad">本地组。</span>
          <div class="jd-descrdiv">字符串（String）类型。</div></td>
      </tr>
	  <tr class="alt-color">
        <td class="jd-typecol"><div align="right"><span class="prettyprint lang-xml">sysIp</span></div></td>
        <td class="jd-linkcol"><span class="sympad">设置一个网卡的IP地址。可选。</span>
          <div class="jd-descrdiv">字符串（String）类型。</div></td>
      </tr>
      <tr>
        <td class="jd-typecol"><div align="right"><span class="prettyprint lang-xml">sysMask</span></div></td>
        <td class="jd-linkcol"><span class="sympad">设置该网卡的子网掩码。可选(注：sysIp配置，该值必须配置。)。</span>
          <div class="jd-descrdiv">字符串（String）类型。</div></td>
      </tr>
	  <tr class="alt-color">
        <td class="jd-typecol"><div align="right"><span class="prettyprint lang-xml">sysGateway</span></div></td>
        <td class="jd-linkcol"><span class="sympad">设置该网卡的默认网关地址。可选。</span>
          <div class="jd-descrdiv">字符串（String）类型。</div></td>
      </tr>
      <tr>
        <td class="jd-typecol"><div align="right"><span class="prettyprint lang-xml">sysdns</span></div></td>
        <td class="jd-linkcol"><span class="sympad">主DNS服务器。可选。</span>
          <div class="jd-descrdiv">字符串（String）类型。</div></td>
      </tr><tr class="alt-color">
        <td class="jd-typecol"><div align="right"><span class="prettyprint lang-xml">secondaryDns</span></div></td>
        <td class="jd-linkcol"><span class="sympad">备DNS服务器。可选。</span>
          <div class="jd-descrdiv">字符串（String）类型。</div></td>
      </tr>
      <tr>
        <td class="jd-typecol"><div align="right"><span class="prettyprint lang-xml">isBindIp</span></div></td>
        <td class="jd-linkcol"><span class="sympad">设置ip信息的网卡是否设置绑定IP。</span>
          <div class="jd-descrdiv">枚举值：true 或 false（字母需全部小写）。</div></td>
      </tr>
  </table>
  
<h2><a name="result"></a>返回结果</h2>
<dl>
  <dt><b>状态码</b></dt>
  <dd>
  <ul>
    <li>HTTP/1.1 200 OK：成功。</li>
  </ul>
  </dd>
</dl>

    <h2><a name="example"></a>应用举例</h2>
    <p>部署虚拟机ccc</p>
    <dl>
      <dt><b>请求</b></dt>
      <div class="source">
        <pre>&lt;domainConfig&gt;<br>    &lt;id&gt;69&lt;/id&gt;<br>    &lt;domainName&gt;ccc&lt;/domainName&gt;<br>    &lt;title&gt;ccc&lt;/title&gt;<br>    &lt;targetHostId&gt;1&lt;/targetHostId&gt;<br>    &lt;deployMode&gt;1&lt;/deployMode&gt;<br>    &lt;protectMode&gt;0&lt;/protectMode&gt;<br>    &lt;storage&gt;<br>        &lt;src&gt;mini_for_v_cvkzyb_test4&lt;/src&gt;<br>        &lt;dest&gt;ccc&lt;/dest&gt;<br>        &lt;pool&gt;serverpool&lt;/pool&gt;<br>    &lt;/storage&gt;<br>    &lt;network&gt;<br>        &lt;mac&gt;0c:da:41:1d:cc:7b&lt;/mac&gt;<br>        &lt;vSwitchName&gt;vswitch0&lt;/vSwitchName&gt;<br>        &lt;profileName&gt;Default&lt;/profileName&gt;<br>        &lt;sysIpType&gt;2&lt;/sysIpType&gt;<br>        &lt;ip&gt;192.168.20.20&lt;/ip&gt;<br>        &lt;sysMask&gt;255.255.0.0&lt;/sysMask&gt;<br>        &lt;sysGateway&gt;192.168.20.1&lt;/sysGateway&gt;<br>        &lt;sysDns&gt;8.8.8.8&lt;/sysDns&gt;<br>        &lt;secondaryDns&gt;8.8.8.7&lt;/secondaryDns&gt;<br>        &lt;isBindIp&gt;false&lt;/isBindIp&gt;<br>    &lt;/network&gt;<br>&lt;/domainConfig&gt;</pre>
        <pre class="prettyprint lang-xml">&nbsp;</pre>
      </div>
      <dt><b>回应</b></dt>
         <div class="source"><pre class="prettyprint lang-xml">HTTP/1.1 200 OK<br>Set-Cookie: JSESSIONID=81998D45B5984EF6857D31B78EF5EFA1; Path=/cas<br>Content-Type: application/xml<br>Content-Length: 204<br>Date: Wed, 10 Dec 2014 03:18:54 GMT<br>Server: H3C-CVM<br>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;<br>&lt;taskMsg&gt;<br>  &lt;msgId&gt;1415257489014&lt;/msgId&gt;<br>  &lt;targetName&gt;rrr&lt;/targetName&gt;<br>  &lt;completed&gt;false&lt;/completed&gt;<br>  &lt;progress&gt;0&lt;/progress&gt;<br>  &lt;eventType&gt;0&lt;/eventType&gt;<br>&lt;/taskMsg&gt;<br>
         </pre>
  </div>
    </dl>
    
</div>
</div>
</body>
</html>